package com.gitee.wsl.compose.chart.pie.label

import androidx.compose.ui.layout.Placeable
import com.gitee.wsl.compose.chart.frond.LabelPosition
import com.gitee.wsl.compose.chart.pie.model.PieSliceData

/**
 * This interface is implemented to provide specific layout algorithms for positioning of Pie Slice labels around
 * the outside of the Pie.
 */
 interface LabelPositionProvider {
    /**
     * Computes [ExternalLabelPosition] for every pie slice for a given [pieDiameter] and list of label [placeables].
     *
     * [placeables] and [pieSliceData] are ordered according to the data values provided to PieChart, and the
     * returned [List] of [ExternalLabelPosition] must be in the same order.
     *
     * This function may be called multiple times per composition as part of the process for maximizing the pie
     * diameter and should not rely on the results of prior invocations or save state for use between invocations.
     *
     * @param holeSize A relative size for an inner hole of the pie, creating a donut chart, with a
     *  value between 0 and 1. See [PieChart].
     */
     fun computeLabelPositions(
        pieDiameter: Float,
        holeSize: Float,
        placeables: List<Placeable>,
        pieSliceData: List<PieSliceData>
    ): List<LabelPosition>
}

